![]() |
PATH![]() |
![]() ![]() |
Downloads data synchronously from a URL.
OSStatus URLSimpleDownload (
const char* url,
FSSpec* destination,
Handle destinationHandle,
URLOpenFlags openFlags,
URLSystemEventProcPtr eventProc,
void* userContext);
The URLSimpleDownload function downloads data synchronously from a specified URL to a specified file or directory and does not return until the download is complete. The URLSimpleDownload function yields time to other threads. Your application should call URLSimpleDownload from a thread other than the main thread so that other processes have time to run.
If you want a progress indicator to be displayed during the download, specify kURLDisplayProgressFlag in the openFlags parameter. The URL Access Manager uses a modal dialog box to display the progress indicator.
If your application has multiple threads, it can call URLSimpleDownload multiple times, but if it calls URLSimpleDownload with kURLDisplayProgressFlag set in openFlags when the URL Access Manager is already displaying a modal dialog box, URLSimpleDownload returns the error kURLProgessAlreadyDisplayedError .
If the url parameter specifies a file, the file is downloadedregardless of whether kURLDirectoryListingFlag or KURLIsDirectoryHintFlag is set in the openFlags parameter.
When URLSimpleDownload downloads data from a file:/// URL, the data fork is downloaded but the resource fork is not downloaded.
Call URLDownload if you need to set properties or URLOpen if you need to control the download process.